package collection;

import javax.swing.JPanel;
import javax.swing.JMenuBar;
import javax.swing.JButton;
import java.awt.FlowLayout;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout;
import java.awt.ScrollPane;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.TextArea;
import javax.swing.JTextArea;

public class SearchPanel extends JPanel {
	
	private JTextField textField;

	JTextArea textArea = new JTextArea();
	
	
	/**
	 * Create the panel.
	 */
	public SearchPanel() {
		setLayout(null);
		
		JButton button = new JButton("\uC870\uD68C");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			
				String str = textField.getText();
				
				int pos = ListFrame.list.indexOf(str);
				
				String str2 = ListFrame.list.get(pos);
				
				textArea.setText("");
				textArea.append(str2);
				
			}
		});
		button.setBounds(309, 23, 97, 23);
		add(button);
		
		textField = new JTextField();
		textField.setBounds(28, 24, 269, 21);
		add(textField);
		textField.setColumns(10);
		
		// JTextArea textArea = new JTextArea();
		textArea.setText("");
		for(String str :ListFrame.list) {
			textArea.append(str + "\n");
		}
		textArea.setBounds(28, 84, 383, 194);
		add(textArea);

	}
}

